<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .container{
            display: grid; /*将container定义为栅格容器*/
            width: 300px;
            height: 300px;
            border: 1px solid;
            grid-template-rows: 100px 100px 100px;
            grid-template-columns: 100px 100px 100px;
        }
        .container >div{
            background-color: red;
            background-clip: content-box;
            border: 1px solid;
            padding: 10px;
            box-sizing: border-box;
        }

        /*********************************/

        .container2{
            display: grid; 
            width: 300px;
            height: 300px;
            border: 1px solid;
            grid-template-rows: 50% 50%;
            grid-template-columns: 20% 20% 20% 20% 20%;
        }
        .container2 >div{
            background-color: red;
            background-clip: content-box;
            border: 1px solid;
            padding: 10px;
            box-sizing: border-box;
        }
        /*********************************/
        .container3{
            display: grid; 
            width: 300px;
            height: 300px;
            border: 1px solid;
            grid-template-rows: repeat(2,50%);  /*repeat 的第一个参数表示 重复几次   等同于上面的代码 50% 50%*/ 
            grid-template-columns: repeat(5,20%);
        }
        .container3 >div{
            background-color: red;
            background-clip: content-box;
            border: 1px solid;
            padding: 10px;
            box-sizing: border-box;
        }
        /*********************************/
        .container4{
            display: grid; 
            width: 300px;
            height: 300px;
            border: 1px solid;
            grid-template-rows: repeat(2,100px 200px);  /*相当于 100px 200px 100px 200px*/ 
            grid-template-columns: repeat(5,20%);
        }
        .container4 >div{
            background-color: red;
            background-clip: content-box;
            border: 1px solid;
            padding: 10px;
            box-sizing: border-box;
        }
    </style>
</head>
<body>
    <div class="container">
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
        <div>5</div>
        <div>6</div>
        <div>7</div>
    </div>
    <hr/>
    <div class="container2">
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
        <div>5</div>
        <div>6</div>
        <div>7</div>
        <div>8</div>
        <div>9</div>
        <div>10</div>
    </div>
    <hr/>
    <div class="container3">
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
        <div>5</div>
        <div>6</div>
        <div>7</div>
        <div>8</div>
        <div>9</div>
        <div>10</div>
       
    </div>
    <hr/>
    <div class="container4">
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
        <div>5</div>
        <div>6</div>
        <div>7</div>
        <div>8</div>
        <div>9</div>
        <div>10</div>
       
    </div>
</body>
</html>